home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_railseek_m.cog < prev    next >
Text File  |  1998-02-25  |  4KB  |  129 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # POW_RAILSEEK_M.COG
  4. #
  5. # POWERUP Script - Seeking Rail Detonator
  6. #
  7. # [YB & CYW, RF]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16.  
  17. int         bin=127                          local
  18.  
  19. # The seeker railgun is treated as a different weapon internally.
  20. int         abin=137                         local
  21.  
  22. # The weapon order bin
  23. int         wobin=17                         local
  24.  
  25. # Awards seeking rounds, not regular ones.
  26. int         ammobin=91                       local
  27. sound       pickupsnd=powerpu1.wav           local
  28. sound       respawnsnd=Activate01.wav        local
  29. flex        amount                           local
  30.  
  31. int         bin_contents=0                   local
  32. int         autopickup=0                     local
  33. int         autosel=-1                       local
  34.  
  35. message     touched
  36. message     taken
  37. message     respawn
  38.  
  39. end
  40.  
  41. # ========================================================================================
  42.  
  43. code
  44.  
  45. touched:
  46.    player = GetSourceRef();
  47.    if (GetThingType(player) == 10)  // Can only be taken by players.
  48.    {
  49.       if(IsMulti() || (GetInv(player, bin) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
  50.       {
  51.          TakeItem(GetSenderRef(), -1);
  52.          call taken;
  53.       }
  54.    }
  55.  
  56.    Return;
  57.  
  58. # ........................................................................................
  59.  
  60. taken:
  61.    player = GetSourceRef();
  62.    powerup = GetSenderRef();
  63.  
  64.    // Do effects.
  65.    PlaySoundLocal(pickupsnd, 1, 0, 0);
  66.    AddDynamicTint(player, 0.0, 0.0, 0.2);
  67.  
  68.    if(GetInv(player, bin) == 0)
  69.    {
  70.       // Pickup gun and ammo.
  71.       // Print("Rail Detonator");
  72.       jkPrintUNIString(player, abin);
  73.  
  74.       ChangeInv(player, bin, 1.0);
  75.       ChangeInv(player, abin, 1.0);
  76.       ChangeInv(player, ammobin, 6.0);
  77.  
  78.       // Check for Auto Pickup
  79.       autopickup = GetAutoPickup();
  80.       if((autopickup & 1) && !(autopickup & 2)) // DANGEROUS
  81.       {
  82.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, abin, 0))))
  83.          {
  84.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  85.             {
  86.                SelectWeapon(player, abin);
  87.                Return;
  88.             }
  89.          }
  90.       }
  91.    }
  92.    else
  93.    if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
  94.    {
  95.       // Pickup ammo only.
  96.       // Print("Rail Charges");
  97.       jkPrintUNIString(player, ammobin);
  98.  
  99.       // store the old bin contents
  100.       bin_contents = GetInv(player, ammobin);
  101.  
  102.       ChangeInv(player, abin, 1.0);
  103.       ChangeInv(player, ammobin, 6.0);
  104.  
  105.       // Check for Auto Reload
  106.       if(GetAutoReload() & 1)
  107.       {
  108.          if(!bin_contents)
  109.          {
  110.             if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  111.             {
  112.                // Try to autoselect and see if the best weapon is the railgun
  113.                if(AutoSelectWeapon(player, 2) == wobin) SelectWeapon(player, wobin);
  114.             }
  115.          }
  116.       }
  117.    }
  118.  
  119.    Return;
  120.  
  121. # ........................................................................................
  122.  
  123. respawn:
  124.    PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
  125.  
  126.    Return;
  127.  
  128. end
  129.